home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <winb.h>
- #include <te.h>
- #include <fntb.h>
- #include <gui.h>
- #include <egb.h>
- #include <guidbg.h>
-
- #include <KH.h>
-
- //#define DEBUG
-
- char *guiEgbPtr ; /* EGB のワークアドレス */
-
- int dialogID = -1 ;
- int messageID[2] = -1 ;
-
- char commandChar[129] ; // コマンド文字列
-
- int userFunc(apliId, messId, info, data)
- int apliId;
- int messId;
- int info;
- int data;
- {
- /* register int ret;
-
- ret = ILLEGAL_FUNCTION;
-
- switch(messId)
- {
- case GM_QUIT :
- MMI_SetHaltFlag(TRUE);
- ret = NOERR ;
- break;
- }
-
- */ return ILLEGAL_FUNCTION;
- // return(ret);
- }
-
- void main(int argc,char *argv[])
- {
- static MMICTRL mmi ={
- SCREEN16|SCREENIGNORE, // ページ0側解像度
- SCREENUNUSED, // ページ1側解像度
- 0, // 書き込みページ
- SCREENAVAILABLE, // 表示ページ
- 0, // 表示プライオリティ
- SCREENAVAILABLE, // 色数
- SCREENEXPAND, // VRAMの横の長さ
- 0, // メモリ領域の大きさ
- NULL, // メモリ領域のアドレス
- 0, // ユーザ領域の大きさ
- NULL, // ユーザ領域のアドレス
- 0, 0, // 画面枠 lupx,lupy
- 0, 0, // rdwx,rdwy
- -16384, -16384, // 移動枠 lupx,lupy
- 16383, 16383, // rdwx,rdwy
- 15, // 白色
- 8, // 黒色
- 7, // 灰色
- 6 // 反転色
- };
-
- int i;
-
- if(argc<2) return ;
-
- commandChar[0] = '\0';
-
- for(i=1;i<argc;i++)
- {
- #ifdef DEBUG
- printf("argv[%d]'%s'\n",i,argv[i]);
- #endif
- strcat(commandChar,argv[i]);
- strcat(commandChar," \0");
- }
-
- extern int APL_init() ;
-
- /* 初期化処理 */
- if (MMI_Open( &mmi ) == NOERR)
- {
- /* 初期化に成功すればメインループに入る. */
- if (APL_init() == NOERR)
- MMI_ExecSystem() ;
- }
-
- /* 終了処理 */
- MMI_Close() ;
-
- }
-
- int APL_init()
- {
- extern MMIINIT initDataCOMMAND ;
-
- int ret,mret,mptr ;
-
- mret = MG_PushPtr(MB_WAIT,&mptr); // MB_WAIT==目覚まし時計
-
- /* EGB ワークアドレスの取得. */
- guiEgbPtr = MMI_GetEgbPtr() ;
-
- /* ハイパ型部品の初期化 */
- if ((ret = MMI_initHyper()) < 0)
- return ret ;
- /* ダイアログ型部品の初期化 */
- if ((ret = MMI_initDialogL40()) < 0)
- return ret ;
- /* メッセージ型部品の初期化 */
- if ((ret = MMI_initMessageL40()) < 0)
- return ret ;
-
- /* 背景データの初期化 */
-
- /* データの登録 */
- if ((ret = MMI_Init(&initDataCOMMAND)) < 0)
- return ret ;
-
- // Tmenuにパレットを合わせる
- KH_initGuiColor();
-
- /* 背景を表示する */
- MMI_SendMessage(MMI_GetBaseObj(), MM_SHOW, 0) ;
-
- MMI_SendMessage(MMI_GetBaseObj(), MM_SETEXEC, 1, userFunc);
- MMI_CallMessage(MMI_GetApliId(), GM_TITLE, (int)"コマンド実行しまっせ~ By 機拡", 0);
-
- // コマンド実行
- #ifdef DEBUG
- printf("command'%s'\n",commandChar);
- #endif
- system( commandChar );
-
- // 消す
- MMI_SendMessage(MMI_GetBaseObj(), MM_ERASE, 0) ;
- // 終了フラグをたてる
- MMI_SetHaltFlag(TRUE);
-
- if(mret==0) MG_PopPtr( mptr );
-
- return NOERR ;
- }